package com.sharkburner.aeris.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.sharkburner.aeris.dao.ISiteDao;
import com.sharkburner.aeris.dao.entity.Site;
import com.sharkburner.common.dao.impl.GenericDao;

@Repository
public class SiteDao extends GenericDao<Site> implements ISiteDao {

	@Override
	public Site findByName(String link) {
		StringBuilder hql=new StringBuilder();
		hql.append(" from ").append(Site.class.getName());
		hql.append(" where link=:link");
		
		Query query=getSession().createQuery(hql.toString());
		query.setParameter("link", link);
		
		return (Site) query.uniqueResult();
	}
	
}
